In [1]:
import opengrid as og
from opengrid import datasets

In [1]:
%matplotlib inline

In [4]:
df = datasets.get('gas_2016_hour')

We want to create a monthly model for one of the gas counters.

Please note that the data does not contain any weater variable, only two other gas counters.


In [12]:
df_month = df.resample('MS').sum().loc['2016']/1000 # kWh/month
mvlr = og.MultiVarLinReg(df_month, endog='313b')

In [13]:
print(mvlr.fit.summary())
mvlr.plot()


/home/roel/.local/lib/python3.5/site-packages/scipy/stats/stats.py:1390: UserWarning: kurtosistest only valid for n>=20 ... continuing anyway, n=12
  "anyway, n=%i" % int(n))
/home/roel/work/opengrid/code/og/opengrid/library/regression.py:397: SettingWithCopyWarning: 
A value is trying to be set on a copy of a slice from a DataFrame

See the caveats in the documentation: http://pandas.pydata.org/pandas-docs/stable/indexing.html#indexing-view-versus-copy
  dfmodel.sort_index(inplace=True)
                            OLS Regression Results                            
==============================================================================
Dep. Variable:              Q('313b')   R-squared:                       0.633
Model:                            OLS   Adj. R-squared:                  0.596
Method:                 Least Squares   F-statistic:                     17.26
Date:                Sun, 10 Dec 2017   Prob (F-statistic):            0.00197
Time:                        21:46:40   Log-Likelihood:                -95.066
No. Observations:                  12   AIC:                             194.1
Df Residuals:                      10   BIC:                             195.1
Df Model:                           1                                         
Covariance Type:            nonrobust                                         
==============================================================================
                 coef    std err          t      P>|t|      [0.025      0.975]
------------------------------------------------------------------------------
Intercept    462.9106    306.924      1.508      0.162    -220.960    1146.781
Q('d5a7')      1.6868      0.406      4.154      0.002       0.782       2.591
==============================================================================
Omnibus:                        7.304   Durbin-Watson:                   0.357
Prob(Omnibus):                  0.026   Jarque-Bera (JB):                4.024
Skew:                           1.402   Prob(JB):                        0.134
Kurtosis:                       3.425   Cond. No.                     1.10e+03
==============================================================================

Warnings:
[1] Standard Errors assume that the covariance matrix of the errors is correctly specified.
[2] The condition number is large, 1.1e+03. This might indicate that there are
strong multicollinearity or other numerical problems.
Out[13]:
[<matplotlib.figure.Figure at 0x7f58241dbe80>,
 <matplotlib.figure.Figure at 0x7f582414c9b0>]

In [ ]: